<template>
  <div class="container">
    <mt-header fixed title="我的预约记录">
        <router-link :to="{name:'index'}" slot="left">
          <mt-button icon="back">返回</mt-button>
        </router-link>
    </mt-header>
    <div class="user-detail">
      <div class="user-detail__img">
        <img  src="../assets/head.jpg" height="334" width="334" alt="">
      </div>
      <div class="user-detail__message">
        <p class="user-detail__message__phone">游客</p>
      </div>
    </div>
    <div class="profile-box">
      <div class="t_title">
      </div>
      <div class="weui-cells weui-cells_form">
        <div class="weui-cell weui-cell_vcode">
          <div class="weui-cell__hd">
            <label class="weui-label">手机号</label>
          </div>
          <div class="weui-cell__bd">
            <input class="weui-input" type="number" placeholder="请输入手机号查询预定" v-model="phone">
          </div>
          <div class="weui-cell__ft">
            <img class="weui-vcode-img" src="../assets/queryBtn.png" @click="this.handleQuery">
          </div>
        </div>
      </div>
      <div class="t_title">
      </div>
      <div class="weui-cells profile" v-for ="item in touristList" v-if="touristList.length >0">
          <div class="weui-cell">
            <div class="weui-cell__hd" :class="item.zoneList.length>0 ? 'border-right':''">
               <div class="weui-cell_access">
                  <router-link :key="item.id" :to="{name: 'touristDetail', params:{touristId:item.projectId}}" >
                      <h4>{{item.projectName}}</h4>
                  </router-link>
               </div>
               <div class="booked-time"><span>时间：</span><span>{{item.bookedTime}}</span></div>
               <div class="user-phone"><span>手机号码：</span><span>{{item.contactPhone}}</span></div>
               <div class="booked-number"><span>报名人数：{{item.bookedNumber}}</span></div>
            </div>
            <div class="weui-cell__hd" v-if="item.zoneList.length>0">
              <div v-for="zone in item.zoneList">
                  <pre>{{zone.zoneName}}</pre>
              </div>
            </div>
          </div>
      </div>
    </div>
  </div>

</template>
<script>
  import fetch from '../utils/fetch';
  export default{
    name: 'mine',
    data(){
      return{
        accountInfo: '',
        popupVisible: true,
        pageReq:{
          count:'',
          page:'',
          contactPhone:''
        },
        phone: '',
        touristList:[]
      }
    },
    methods:{
      handleQuery(){
        this.pageReq.count = 999;
        this.pageReq.page = 0;
        this.pageReq.contactPhone = this.phone;

        let formData = JSON.stringify(this.pageReq)
        fetch.post('api/project/booked/list',formData).then(response =>{
          if(response.data.success){
            this.touristList = response.data.response
          }
        })
      },

    },
    mounted(){
    }
  }
</script>
<style scoped lang="scss">
 @import '../../static/css/weui.css';
  @import '../base/css/base.scss';
  .container{
    padding-bottom: 1.11rem;
    background: #FFFFFF;
    height: inherit;
    .mint-header{
        font-size: 16px;
        height: 45px;
        line-height: 45px;
        background-color: #f2f2f2!important;
        box-sizing: border-box;
        color: #101010;
    }
    .user-detail {
      position: relative;
      height: 4rem;
      width: 100%;
      background: #FFF;
      color: #fff;
      margin-top: 45px;
      padding: 0 18px;
      box-sizing: border-box;
      border: 1px solid #e5e5e5;
      @include flex-center;
      .user-detail__img{
        width:1.7625rem;
        height: 1.7625rem;
        img{
          width: 100%;
          height: auto;
          border-radius:50%;
        }
      }
      .user-detail__message{
        flex:1;
        p{
          padding:0.2rem 0;
          @include fz(9px);
          color: #101010;
          text-align:center;
        }
      }
    }
    .t_title{
      height: 10px;
      line-height: 10px;
      padding: 2px 0 2px 0;
      background-color: #f2f2f2;
    }
    .profile-box{
        padding-bottom: 50px;
        .t_title p{
          padding-left: 18px;
          color: #101010;
        }
        .weui-vcode-img{
           height: 30px;
           padding: 5px;
        }
        .profile{
          padding: 8px;
          .weui-cell{
            border: 1px solid #F15F5C;
            padding: 10px;
            .weui-cell__hd{
               width: 50%;
              div{
                padding: 3px 0;
                font-size: 12px;
                color: #101010;
              }
              .weui-cell_access{
                 h4{
                  font-weight: bold !important;
                  font-size: 14px !important;
                  line-height: 14px;
                  color: #101010;
                }
              }
              .booked-number{

                span{
                  background-color: #f2f2f2;
                  border: 1px solid #F15F5C;
                  border-radius: 4px;
                  padding: 2px 13px;
                  color: #F15F5C;
                }
              }
            }
          }
        }

    }


    .profile, .setting{
      margin: 0;
    }
    .profile:last-child{
      margin-bottom:50px;
    }
    .btn-warp{
      margin: 20px 0;
    }
    .border-right{
        border-right: 1px solid #e5e5e5;
        margin-right:10px;
    }
  }
</style>
